﻿<Window x:Class="Microsoft.Samples.Kinect.WebserverWebGL.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:tk="clr-namespace:Microsoft.Kinect.Toolkit;assembly=Microsoft.Kinect.Toolkit"
        xmlns:local="clr-namespace:Microsoft.Samples.Kinect.WebserverWebGL"
        Title="Webserver Basics" SizeToContent="Height" Width="800" FontSize="16"
        Loaded="WindowLoaded"  Closing="WindowClosing">
    
    <Window.Resources>
        <local:InverseBooleanConverter x:Key="inverseBooleanConverter"/>
    </Window.Resources>
    
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <tk:KinectSensorChooserUI Grid.Row="0" Grid.Column="0" KinectSensorChooser="{Binding KinectSensorChooser}" HorizontalAlignment="Left" IsListening="False" Margin="5"/>
        <DockPanel Grid.Row="0" Grid.Column="1" Margin="5">
            <Button DockPanel.Dock="Top" Height="50" Width="100" Content="Start"
                    IsEnabled="{Binding Path=IsStarted, Converter={StaticResource inverseBooleanConverter}}" Click="StartButtonOnClick"/>
            <Button DockPanel.Dock="Top" Height="50" Width="100" Content="Stop"
                    IsEnabled="{Binding Path=IsStarted}" Click="StopButtonOnClick"/>
        </DockPanel>
        <StackPanel Grid.Row="0" Grid.Column="2" Margin="10 0">
            <TextBlock x:Name="OpenBrowserText" Margin="0 5">
                <Hyperlink FontSize="16" x:Name="UriLink" Click="UriLinkOnClick">Open sample page in default browser</Hyperlink>
                <LineBreak/>
                <Run FontSize="11">See documentation for list of supported browsers</Run>
            </TextBlock>
            <TextBlock x:Name="ServingFilesText" Margin="0 5" FontSize="11" TextWrapping="WrapWithOverflow">
                <Run FontSize="14" FontWeight="Bold">Serving files from:</Run>
                <Run x:Name="RootDirectoryTextRun"/>
                <LineBreak/>
                Edit FileRootDirectory property in configuration file (.exe.config) and restart server application to serve files from a different directory.
            </TextBlock>
            <TextBlock x:Name="NotServingFilesText" Margin="0 5" FontSize="14" FontWeight="Bold" Visibility="Collapsed">
                Not Serving Files
            </TextBlock>
        </StackPanel>
        <Expander Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch" Margin="5 0 5 5"
                  ExpandDirection="Down" IsExpanded="True"
                  Header="Errors:" FontWeight="Black">
            <TextBox IsReadOnly="True" VerticalScrollBarVisibility="Visible" HorizontalScrollBarVisibility="Auto" MinHeight="200"
                     FontSize="10" Text="{Binding Path=ErrorText}"/>
        </Expander>
    </Grid>
</Window>
